<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>

<rich:panel header="Member Agreement Transfer">
	<h:panelGrid ><h:outputText value="#{errorBean.errorMessage}" styleClass="error"></h:outputText></h:panelGrid>
 		<t:panelGrid columns="2" columnClasses="standardTable_ColumnLeft_20,standardTable_ColumnLeft_80" width="100%"
 			rendered="#{!memberAgreementTransferBean.lookupAgreementForm}">
		
		<h:panelGroup>
			<h:outputLabel value="#{messages['membership.no.label']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:outputText value="#{memberAgreementTransferBean.fromMember.membershipNo}"  />
		
		<h:panelGroup>
			<h:outputLabel value="Member Name" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:outputText value="#{memberAgreementTransferBean.fromMember.name}"  />
		
		<h:outputText></h:outputText>
		<t:message for="agreementNo" styleClass="error"></t:message>
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="agreementNo" value="#{messages['member.agreement.label']}" styleClass="standardText_Label" />
		</h:panelGroup>
	
		<h:panelGroup>
		    <h:inputText  size="20" readonly="true" value="#{memberAgreementTransferBean.agreement.agreetmentNo}" required="true"></h:inputText>
			<h:commandButton value="#{messages['search']}" styleClass="button" action="null" actionListener="#{memberAgreementTransferBean.lookupAgreementFormActionEvent}" immediate="true">
			</h:commandButton>
			<h:inputHidden required="true" id="agreementNo" value="#{memberAgreementTransferBean.agreement.agreetmentNo}"></h:inputHidden>
		</h:panelGroup>
		
		<h:panelGroup>
			<h:outputLabel value="Agreement Date" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:outputText value="#{memberAgreementTransferBean.agreement.agreetmentDate}"  >
			<f:convertDateTime pattern="dd/MM/yyyy" timeZone="Asia/Kuala_Lumpur"/>
		</h:outputText>	
		
		<h:panelGroup>
			<h:outputLabel value="Agreement Expiry" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:outputText value="#{memberAgreementTransferBean.agreementExpiredDate}" >
			<f:convertDateTime pattern="dd/MM/yyyy" timeZone="Asia/Kuala_Lumpur"/>
		</h:outputText>	
		
		<h:panelGroup>
			<h:outputLabel value="Agreement Status" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:outputText value="#{memberAgreementTransferBean.status}" />
		
		<h:panelGroup>
			<h:outputLabel value="Membership Category" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:outputText value="#{memberAgreementTransferBean.agreement.membership.membershipCategory.name}"  />
		
		<h:outputText></h:outputText>
		<t:message for="invoice" styleClass="error"></t:message>
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="invoice" value="Invoice Charge" styleClass="standardText_Label" />
		</h:panelGroup>
		<t:inputText id="invoice" required="true" styleClass="standardText" value="#{memberAgreementTransferBean.invoiceCharge}">
			<f:convertNumber pattern="#0.00"/>
		</t:inputText>
		
		<t:panelGroup>
		   <t:panelGrid columns="2">
		   		<h:commandButton value="Transfer" type="submit" styleClass="button"  action="#{memberAgreementTransferBean.transferAction}" ></h:commandButton>
		   </t:panelGrid>
		</t:panelGroup>
		 
	</t:panelGrid>	
	
		<h:panelGrid width="100%" rendered="#{memberAgreementTransferBean.lookupAgreementForm}" columns="1">
		<h:outputText value="#{messages['agreement.lookup.label']}" styleClass="sub_header" />
		
		<rich:dataTable id="dataAgreement" var="agreement" value="#{memberAgreementTransferBean.agreements}" rows="20" width="99%">
				<rich:column style="text-align:center;width:20%;">
					<f:facet name="header">
						<h:outputText value="#{messages['agreement.no.column']}"></h:outputText>
					</f:facet>
				
					<h:commandLink  actionListener="#{memberAgreementTransferBean.lookupAgreementSelectedActionEvent}">
						<h:outputText value="#{agreement.agreetmentNo}"></h:outputText>
					</h:commandLink>
					<f:param id="agreementId" value="#{agreement.agreementId}" />
				</rich:column>	
				
				<rich:column style="text-align:center;width:20%;">
					<f:facet name="header">
						<h:outputText value="#{messages['agreement.date.column']}"></h:outputText>
					</f:facet>
					<h:outputText value="#{agreement.agreetmentDate}">
						<f:convertDateTime pattern="dd/MM/yyyy" timeZone="Asia/Kuala_Lumpur"/>
					</h:outputText>
				</rich:column>
				
				<rich:column style="text-align:center;width:20%;">
					<f:facet name="header">
						<h:outputText value="#{messages['membership.type.column']}"></h:outputText>
					</f:facet>
					<h:outputText value="#{agreement.membership.name}"></h:outputText>
				</rich:column>
		</rich:dataTable>
		
		<rich:spacer height="10"></rich:spacer>
					
		<rich:datascroller align="left"  for="dataAgreement" maxPages="20" />
			
		<h:commandButton value="#{messages['back']}" styleClass="button" action="null" actionListener="#{memberAgreementTransferBean.lookupFormCloseActionEvent}" immediate="true">
		</h:commandButton>
	</h:panelGrid>
	
</rich:panel>
